<template>
  <view>
    <Layout>
      <view class="container">
        <view class="icon_button discount_query" @click="handelGo('/pages/discount/index')">
          <i class="iconfont icon-chengbenguanli"></i>
          <text class="title">折扣查詢</text>
          <text class="subtitle">最後更新: {{ updateTime }}</text>
        </view>

        <view class="icon_button personal_info" @click="handelGo('/pages/petition/myPetition/index')">
          <i class="iconfont icon-jietisilu" style="color: #423f3f;"></i>
          <text class="title">我的簽呈</text>
        </view>

        <view class="icon_button personal_info" @click="handelGo('/pages/salesman/myBonus/index')">
          <i class="iconfont icon-5" style="color: #c48626;"></i>
          <text class="title">我的獎金</text>
        </view>
        
        <view class="icon_button personal_info" @click="handelGo('/pages/personal/index')">
          <i class="iconfont icon-a-userlister-line"></i>
          <text class="title">個人資料</text>
        </view>

        <view class="icon_button open_website" @click="openWebsite">
          <image src="@/static/img/common/websit.png" class="logo_image" mode="widthFix" />
          <text class="title" >打開官網</text>
        </view>

      </view>
    </Layout>
  </view>
</template>

<script>
import { getDashboardInfo } from "@/api/dashboard.js";
export default {
  data() {
    return {
      updateTime: ''
    };
  },
  onLoad() {},
  mounted() {
   getDashboardInfo().then(res=>{
    this.updateTime = res.data.lastUpdateTime
   })
  },
  methods:{
    openWebsite(){
        window.open('https://www.cocloud.com');
    },
    handelGo(url){
      uni.navigateTo({
        url:url
      })
    }
  }
};
</script>

<style lang="scss" scoped>
.container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding: 50rpx;
  margin-top: 80rpx;
  

  .icon_button {
    width: 50%;
    height: 200rpx;
    gap: 10rpx;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 60rpx;

    .iconfont {
      font-size: 70rpx;
    }

    .title {
      font-size: 36rpx;
      color: #333;
      margin-bottom: 5rpx;
    }

    .subtitle {
      font-size:22rpx;
      color: #999;
    }
  }

  .open_website{
    .logo_image {
      width: 21%;
    }
  }

  /* .personal_info {
    .iconfont {
      font-size: 70rpx;
    }
  } */
}
</style>
